bleh
[mqlkit.git] / indicators / Meta COT Percent Position in OI.mq4
blobd218666699faf198e4da712cd8ce7da26f8cbed9
1 //+------------------------------------------------------------------+
2 //|                              Meta COT Percent Position in OI.mq4 |
3 //|   Copyright  2009, C-4 (Vasiliy Sokolov, Russia, St.-Petersburg,|
4 //|                                      2009), All Rights Reserved. |
5 //|                                                   vs-box@mail.ru |
6 //+------------------------------------------------------------------+
8 //          .
10 #property copyright "Copyright  2009, C-4 (Vasiliy Sokolov, SPb), All Rights Reserved."
11 #property link      "vs-box@mail.ru"
13 #property indicator_separate_window
14 #property  indicator_buffers 6
15 #property  indicator_color1  Blue
16 #property  indicator_color2  SkyBlue
17 #property  indicator_color3  IndianRed
18 #property  indicator_color4  Red
19 #property  indicator_color5  Silver
20 #property  indicator_color6  SlateGray
22 int  period=52;
23 int movement_index=6;
24 extern bool Show_iNoncomm_Long=false;
25 extern bool Show_iNoncomm_Short=false;
26 extern bool Show_iOperators_Long=false;
27 extern bool Show_iOperators_Short=false;
28 extern bool Show_iNonrep_Long=false;
29 extern bool Show_iNonrep_Short=false;
31 double i_noncomm_long[];
32 double i_noncomm_short[];
33 double i_operators_long[];
34 double i_operators_short[];
35 double i_nonrep_long[];
36 double i_nonrep_short[];
38 #include <cotlib.mq4>
40 int init()
42    if(init_data()==false)error=true;
43    if(error==false)load_data();
44    if(error==false)count_data();
45    //if(error==false)count_index(period);
46    SetParam();
49 int start()
51    if(error==true)Print("   .   ");
52    if(DrawData==true)DrowData();
55 void SetParam()
57    SetIndexStyle(0,DRAW_LINE);
58    SetIndexStyle(1,DRAW_LINE);
59    SetIndexStyle(2,DRAW_LINE);
60    SetIndexStyle(3,DRAW_LINE);
61    SetIndexStyle(4,DRAW_LINE);
62    SetIndexStyle(5,DRAW_LINE);
63    SetIndexStyle(6,DRAW_LINE);
64    IndicatorDigits(2);
65    SetIndexEmptyValue(0,EMPTY_VALUE);
66    SetIndexEmptyValue(1,EMPTY_VALUE);
67    SetIndexEmptyValue(2,EMPTY_VALUE);
68    SetIndexEmptyValue(3,EMPTY_VALUE);
69    SetIndexEmptyValue(4,EMPTY_VALUE);
70    SetIndexEmptyValue(5,EMPTY_VALUE);
71    SetIndexEmptyValue(6,EMPTY_VALUE);
72    SetLevelValue(0,0.0);
73    SetLevelValue(1,20.0);
74    SetLevelValue(2,50.0);
75    SetLevelValue(3,80.0);
76    SetLevelValue(4,100.0);
77    if(load_cot_file==true)IndicatorShortName(StringConcatenate("Meta COT % Pos. in OI: ", str_trim(cot_file)));
78    else IndicatorShortName(StringConcatenate("Meta COT % Pos. in OI: ", name));
79    if(Show_iNoncomm_Long==true){
80       SetIndexBuffer(0,i_noncomm_long);
81       SetIndexLabel(0, "% Noncomm Long in OI");
82    }
83    if(Show_iNoncomm_Short==true){
84       SetIndexBuffer(1,i_noncomm_short);
85       SetIndexLabel(1,"% Noncomm Short in OI");
86    }
87    if(Show_iOperators_Long==true){
88       SetIndexBuffer(2,i_operators_long);
89       SetIndexLabel(2,"% Operators Long in OI");
90    } 
91    if(Show_iOperators_Short==true){
92       SetIndexBuffer(3,i_operators_short);
93       SetIndexLabel(3,"% Operators Short in OI");
94    }
95    if(Show_iNonrep_Long==true){
96       SetIndexBuffer(4,i_nonrep_long);
97       SetIndexLabel(4,"% Nonrep Long in OI");
98    }
99    if(Show_iNonrep_Short==true){
100       SetIndexBuffer(5,i_nonrep_short);
101       SetIndexLabel(5,"% Nonrep Short in OI");
102    }
105 void DrowData()
107    int end_data=get_lastdata();
108    for(int i=0;i<end_data;i++){
109       if(Show_iNoncomm_Long==true)i_noncomm_long[i]=get_data(OI_NONCOMM_LONG,i);
110       if(Show_iNoncomm_Short==true)i_noncomm_short[i]=get_data(OI_NONCOMM_SHORT,i);
111       if(Show_iOperators_Long==true)i_operators_long[i]=get_data(OI_OPERATORS_LONG,i);
112       if(Show_iOperators_Short==true)i_operators_short[i]=get_data(OI_OPERATORS_SHORT,i);
113       if(Show_iNonrep_Long==true)i_nonrep_long[i]=get_data(OI_NONREP_LONG,i);
114       if(Show_iNonrep_Short==true)i_nonrep_short[i]=get_data(OI_NONREP_SHORT,i);
115    }
116    DrawData=false;